﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainSite.Master" AutoEventWireup="true" CodeBehind="DrillingKPI.aspx.cs" Inherits="BSCMFF.Web.Pages.BSC_Setup.DrillingKPI" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">


    <div style="width: 200px; float: left">

        <script type="text/javascript">
            function onNodeClicked(sender, args) {
                showDetails(args.get_node());
//                $get("<%= LabelDescription.ClientID %>").hidden = true;
//                $get("<%= LabelEmployee.ClientID %>").hidden = true;
            }

            function showDetails(node) {
                if (node.get_attributes().getAttribute("NodeType")) {
                    //target
                    if (node.get_attributes().getAttribute("NodeType") == "Strategic_Target") {
                        //                    var position = node.get_attributes().getAttribute("NodeType");
                        var name = node.get_text();
                        //                    var email = node.get_attributes().getAttribute("Email");
                        //                    var phone = node.get_attributes().getAttribute("Phone");
                        var description = node.get_attributes().getAttribute("Description");
                        $get("details").style.display = "block";
                        $get("<%= description.ClientID %>").innerHTML = description;
                        $get("<%= name.ClientID %>").innerHTML = "<br />" + name;


                        $get("<%= LabelEmployee.ClientID %>").hidden = true;
                        //$get("<%= name.ClientID %>").hidden = true;

                        $get("<%= LabelType.ClientID %>").innerHTML = "Target:";

                       // $get("<%= LabelDescription.ClientID %>").hidden = true;

                        $get("<%= employeeLB.ClientID %>").hidden = true;

                    }
                     //solution
                    if (node.get_attributes().getAttribute("NodeType") == "Business_Solution") {
                        //                    var position = node.get_attributes().getAttribute("NodeType");
                        var name = node.get_text();
                        //                    var email = node.get_attributes().getAttribute("Email");
                        //                    var phone = node.get_attributes().getAttribute("Phone");
                        var description = node.get_attributes().getAttribute("Description");
                        $get("details").style.display = "block";
                        $get("<%= description.ClientID %>").innerHTML = description;
                        $get("<%= name.ClientID %>").innerHTML = "<br />" + name;


                        $get("<%= LabelEmployee.ClientID %>").hidden = true;
                        //$get("<%= name.ClientID %>").hidden = true;

                        $get("<%= LabelType.ClientID %>").innerHTML = "Solution:";

                        $get("<%= LabelDescription.ClientID %>").hidden = true;

                        $get("<%= employeeLB.ClientID %>").hidden = true;

                    }
                    //KPI
                    if (node.get_attributes().getAttribute("NodeType") == "KPI") {
//                    var position = node.get_attributes().getAttribute("NodeType");
                    var name = node.get_text();
//                    var email = node.get_attributes().getAttribute("Email");
//                    var phone = node.get_attributes().getAttribute("Phone");
                    var description = node.get_attributes().getAttribute("Description");
                    $get("details").style.display = "block";
                    $get("<%= description.ClientID %>").innerHTML = description;
                    $get("<%= name.ClientID %>").innerHTML = "<br />" + name;


                    $get("<%= LabelEmployee.ClientID %>").hidden = true;
                    //$get("<%= name.ClientID %>").hidden = true;

                    $get("<%= LabelType.ClientID %>").innerHTML = "KPI:";

                    $get("<%= LabelDescription.ClientID %>").hidden = false;

                    $get("<%= employeeLB.ClientID %>").hidden = true;
                    $get("<%= LabelEmployee.ClientID %>").innerHTML = "Employee:";
                    $get("<%= LabelDescription.ClientID %>").innerHTML = "Description:";
                    }
                //else { ///personal kpi
                    if (node.get_attributes().getAttribute("NodeType") == "Personal_KPI") {
                        var name = node.get_text();
                        var description = node.get_attributes().getAttribute("Description");
                        var userID = node.get_attributes().getAttribute("UserID");
                        var fullname = node.get_attributes().getAttribute("Fullname");
                        $get("details").style.display = "block";
                        $get("<%= description.ClientID %>").innerHTML = description;
                        $get("<%= name.ClientID %>").innerHTML = "<br />" + name;
                        $get("<%= employeeLB.ClientID %>").innerHTML = fullname;
                        $get("<%= employeeLB.ClientID %>").href = "../UserPages/EmployeeInfo.aspx?EmployeeID=" + userID;
                        $get("<%= employeeLB.ClientID %>").hidden = false;
                        $get("<%= LabelEmployee.ClientID %>").hidden = false;
                        
                        $get("<%= name.ClientID %>").hidden = false;
                        $get("<%= LabelType.ClientID %>").innerHTML = "PKPI";

                        $get("<%= LabelDescription.ClientID %>").hidden = false;
                        $get("<%= LabelEmployee.ClientID %>").innerHTML = "Employee:";
                        $get("<%= LabelDescription.ClientID %>").innerHTML = "Description:";
                    }
                    

                }
                else {
                    $get("details").style.display = "none";
                }
            }
        </script>

        <telerik:RadTreeView ID="RadTreeView1" runat="Server" 
            OnClientNodeClicked="onNodeClicked" meta:resourcekey="RadTreeView1Resource1">
            
        </telerik:RadTreeView>
    </div>
    <div  style="float: right; width: 500px; 
            padding: 3px 0 0 30px; margin-top: 1px;">
        <div style="color: #4888a3; font-size: 23px; padding-bottom: 10px;">
            <asp:Label runat="Server" ID="LabelType" 
                meta:resourcekey="LabelTypeResource1" />
            <asp:Label runat="Server" ID="name" meta:resourcekey="nameResource1" />
        </div>
        <div id="details" style="font-size: 12px; line-height: 21px;">
            <asp:Label runat="server" ID="LabelDescription" Text="" 
                meta:resourcekey="LabelDescriptionResource1" />
            <asp:Label runat="server" ID="description" 
                meta:resourcekey="descriptionResource1" />
            <br />
            <asp:Label ID="LabelEmployee" runat="server" Text="" 
                meta:resourcekey="LabelEmployeeResource1"></asp:Label>
            <asp:Label runat="server" ID="employee" meta:resourcekey="employeeResource1" />
            <asp:LinkButton runat="server" ID="employeeLB" 
                meta:resourcekey="employeeLBResource1"></asp:LinkButton>
           
        </div>
    </div>
</asp:Content>
